﻿using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Text;

namespace PickGold.Api
{
	public static class Shell32
	{
		/// <summary/>
		public const string DLL = ApiUtil.DLL_SHELL32;

		/// <summary/>
		[DllImport(DLL)]
		public static extern long ShellAbout(long uFlags, long dwReserved);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="hInst"></param>
		/// <param name="lpIconPath"></param>
		/// <param name="lpiIcon"></param>
		/// <returns></returns>
		[DllImport(DLL)]
		public static extern IntPtr ExtractAssociatedIcon(IntPtr hInst, [MarshalAs(UnmanagedType.LPStr)] string lpIconPath, ref int lpiIcon);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="hInst"></param>
		/// <param name="lpszExeFileName"></param>
		/// <param name="nIconIndex">要获取图标的索引，如果传入-1则返回图标总数</param>
		/// <returns></returns>
		[DllImport(DLL)]
		public static extern IntPtr ExtractIcon(IntPtr hInst, [MarshalAs(UnmanagedType.LPStr)] string lpszExeFileName, int nIconIndex);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="lpszFile"></param>
		/// <param name="nIconIndex">要获取图标的索引，如果传入-1则返回图标总数</param>
		/// <param name="phiconLarge"></param>
		/// <param name="phiconSmall"></param>
		/// <param name="nIcons"></param>
		/// <returns></returns>
		[DllImport(DLL)]
		public static extern IntPtr ExtractIconEx(LPCTSTR lpszFile, int nIconIndex, HICON[] phiconLarge, HICON[] phiconSmall, int nIcons);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="pszPath"></param>
		/// <param name="dwFileAttribute"></param>
		/// <param name="psfi"></param>
		/// <param name="cbSizeFileInfo"></param>
		/// <param name="Flags"></param>
		/// <returns></returns>
		[DllImport(DLL)]
		public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttribute, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint Flags);
	}
}
